<?php
namespace Common\Model;
use Common\Common\Model;
class OrderModel extends Model {
    protected $tableName = 'Order';
    protected $tablePrimary = 'ID';
    public function userPage()
    {
        $page = I('get.p');
        $User = M('order'); // 实例化User对象
        $count      = $User->count();// 查询满足要求的总记录数
        $Page       = new \Think\Page($count,2);
        $show       = $Page->show();
        $list = $User->page($page, 2)->select();
        return array(
            'list' => $list,
            'page' => $show,
        );
    }
    public function auditingPage()
    {
        $User = M('order'); // 实例化User对象
        $count      = $User->where('State=0')->count();// 查询满足要求的总记录数
        $Page       = new \Think\Page($count,1);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show       = $Page->show();// 分页显示输出
// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
        $list = $User->where('State=0')->limit($Page->firstRow.','.$Page->listRows)->select();
        return array(
            'list' => $list,
            'page' => $show,
        );

//        $page=I('get.p');
//        $goods = M('order'); // 实例化User对象
//        $count      = $goods->where("State = 0")->count();// 查询满足要求的总记录数
//        $Page       = new \Think\Page($count,2);
//        $show       = $Page->show();
//        if($count) {
//            $list = $goods->page($page, 2)->select();
//        }
//        return array(
//            'list' => $list,
//            'page' => $show,
//        );
    }
}
